<!-- 条形图 -->
<template>
    <div class="banxin">
       <div id="tiaoxingtu" style="width:400px; height:400px;"></div>
    </div>
</template>

<script>
export default {
  name: 'hello',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App'
    }
  },
  mounted(){
    this.drawLine();
  },
  methods: {
    drawLine(){
        // 基于准备好的dom，初始化echarts实例
        let tiaoxingtu = this.$echarts.init(document.getElementById('tiaoxingtu'))
        // 绘制图表
        tiaoxingtu.setOption({
            title: { text: '在Vue中使用echarts' },
            tooltip: {
                textStyle:{
                align:'right'
              },
            },
            xAxis: {
                data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
            },
            //增加右上角 小标题
            legend: {
                data:['销量'],
                left:300
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20],//柱图高度
                barWidth :40,//柱图宽度
            }]
        });
    }
  }
}
</script>
<style type="text/css">
    #tiaoxingtu{
       float: right;
    }
</style>